{% if columns is not empty %}

  <input type="hidden" name="grant_count" value="{{ row|length }}">
  <input type="hidden" name="column_count" value="{{ columns|length }}">
  <div class="card mb-3" id="fieldset_user_priv">
    <div class="card-header js-submenu-label" data-submenu-label="{{ t('Table') }}">
      {{ t('Table-specific privileges') }}
    </div>
    <div class="card-body">
    <p>
      <small><em>{{ t('Note: MySQL privilege names are expressed in English.') }}</em></small>
    </p>

    <div class="item" id="div_item_select">
      <label for="select_select_priv">
        <code><dfn title="{{ t('Allows reading data.') }}">SELECT</dfn></code>
      </label>

      <select class="resize-vertical" id="select_select_priv" name="Select_priv[]" size="8" multiple>
        {% for curr_col, curr_col_privs in columns %}
          <option value="{{ curr_col }}"{{ row['Select_priv'] == 'Y' or curr_col_privs['Select'] ? ' selected' }}>
            {{ curr_col }}
          </option>
        {% endfor %}
      </select>

      <div>
        <button class="btn btn-link p-0" id="select_priv_all" type="button" data-select-target="#select_select_priv">
          {{ t('Select all') }}
        </button>
      </div>

      <em>{{ t('Or') }}</em>
      <label for="checkbox_Select_priv_none">
        <input type="checkbox" name="Select_priv_none" id="checkbox_Select_priv_none" title="
          {{- t('None', context = 'None privileges') }}">
        {{ t('None', context = 'None privileges') }}
      </label>
    </div>

    <div class="item" id="div_item_insert">
      <label for="select_insert_priv">
        <code><dfn title="{{ t('Allows inserting and replacing data.') }}">INSERT</dfn></code>
      </label>

      <select class="resize-vertical" id="select_insert_priv" name="Insert_priv[]" size="8" multiple>
        {% for curr_col, curr_col_privs in columns %}
          <option value="{{ curr_col }}"{{ row['Insert_priv'] == 'Y' or curr_col_privs['Insert'] ? ' selected' }}>
            {{ curr_col }}
          </option>
        {% endfor %}
      </select>

      <div>
        <button class="btn btn-link p-0" id="insert_priv_all" type="button" data-select-target="#select_insert_priv">
          {{ t('Select all') }}
        </button>
      </div>

      <em>{{ t('Or') }}</em>
      <label for="checkbox_Insert_priv_none">
        <input type="checkbox" name="Insert_priv_none" id="checkbox_Insert_priv_none" title="
          {{- t('None', context = 'None privileges') }}">
        {{ t('None', context = 'None privileges') }}
      </label>
    </div>

    <div class="item" id="div_item_update">
      <label for="select_update_priv">
        <code><dfn title="{{ t('Allows changing data.') }}">UPDATE</dfn></code>
      </label>

      <select class="resize-vertical" id="select_update_priv" name="Update_priv[]" size="8" multiple>
        {% for curr_col, curr_col_privs in columns %}
          <option value="{{ curr_col }}"{{ row['Update_priv'] == 'Y' or curr_col_privs['Update'] ? ' selected' }}>
            {{ curr_col }}
          </option>
        {% endfor %}
      </select>

      <div>
        <button class="btn btn-link p-0" id="update_priv_all" type="button" data-select-target="#select_update_priv">
          {{ t('Select all') }}
        </button>
      </div>

      <em>{{ t('Or') }}</em>
      <label for="checkbox_Update_priv_none">
        <input type="checkbox" name="Update_priv_none" id="checkbox_Update_priv_none" title="
          {{- t('None', context = 'None privileges') }}">
        {{ t('None', context = 'None privileges') }}
      </label>
    </div>

    <div class="item" id="div_item_references">
      <label for="select_references_priv">
        <code><dfn title="{{ t('Has no effect in this MySQL version.') }}">REFERENCES</dfn></code>
      </label>

      <select class="resize-vertical" id="select_references_priv" name="References_priv[]" size="8" multiple>
        {% for curr_col, curr_col_privs in columns %}
          <option value="{{ curr_col }}"{{ row['References_priv'] == 'Y' or curr_col_privs['References'] ? ' selected' }}>
            {{ curr_col }}
          </option>
        {% endfor %}
      </select>

      <div>
        <button class="btn btn-link p-0" id="references_priv_all" type="button" data-select-target="#select_references_priv">
          {{ t('Select all') }}
        </button>
      </div>

      <em>{{ t('Or') }}</em>
      <label for="checkbox_References_priv_none">
        <input type="checkbox" name="References_priv_none" id="checkbox_References_priv_none" title="
          {{- t('None', context = 'None privileges') }}">
        {{ t('None', context = 'None privileges') }}
      </label>
    </div>

    <div class="item">
      <div class="item">
        <input type="checkbox" name="Delete_priv" id="checkbox_Delete_priv" value="Y" title="
          {{- t('Allows deleting data.') }}"{{ (row['Delete_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Delete_priv">
          <code>
            <dfn title="{{ t('Allows deleting data.') }}">
              DELETE
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Create_priv" id="checkbox_Create_priv" value="Y" title="
          {{- t('Allows creating new tables.') }}"{{ (row['Create_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Create_priv">
          <code>
            <dfn title="{{ t('Allows creating new tables.') }}">
              CREATE
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Drop_priv" id="checkbox_Drop_priv" value="Y" title="
          {{- t('Allows dropping tables.') }}"{{ (row['Drop_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Drop_priv">
          <code>
            <dfn title="{{ t('Allows dropping tables.') }}">
              DROP
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Grant_priv" id="checkbox_Grant_priv" value="Y" title="
          {{- t('Allows user to give to other users or remove from other users the privileges that user possess yourself.') }}"
          {{- (row['Grant_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Grant_priv">
          <code>
            <dfn title="{{ t('Allows user to give to other users or remove from other users the privileges that user possess yourself.') }}">
              GRANT
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Index_priv" id="checkbox_Index_priv" value="Y" title="
          {{- t('Allows creating and dropping indexes.') }}"{{ (row['Index_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Index_priv">
          <code>
            <dfn title="{{ t('Allows creating and dropping indexes.') }}">
              INDEX
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Alter_priv" id="checkbox_Alter_priv" value="Y" title="
          {{- t('Allows altering the structure of existing tables.') }}"{{ (row['Alter_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Alter_priv">
          <code>
            <dfn title="{{ t('Allows altering the structure of existing tables.') }}">
              ALTER
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Create_view_priv" id="checkbox_Create_view_priv" value="Y" title="
          {{- t('Allows creating new views.') }}"{{ row['Create View_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Create_view_priv">
          <code>
            <dfn title="{{ t('Allows creating new views.') }}">
              CREATE VIEW
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Show_view_priv" id="checkbox_Show_view_priv" value="Y" title="
          {{- t('Allows performing SHOW CREATE VIEW queries.') }}"{{ row['Show view_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Show_view_priv">
          <code>
            <dfn title="{{ t('Allows performing SHOW CREATE VIEW queries.') }}">
              SHOW VIEW
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        <input type="checkbox" name="Trigger_priv" id="checkbox_Trigger_priv" value="Y" title="
          {{- t('Allows creating and dropping triggers.') }}"{{ (row['Trigger_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Trigger_priv">
          <code>
            <dfn title="{{ t('Allows creating and dropping triggers.') }}">
              TRIGGER
            </dfn>
          </code>
        </label>
      </div>

      {% if row['Delete versioning rows_priv'] is defined %}
        <div class="item">
          <input type="checkbox" name="Delete_history_priv" id="checkbox_Delete_history_priv" value="Y" title="
            {{- t('Allows deleting historical rows.') }}"
            {{- row['Delete versioning rows_priv'] == 'Y' ? ' checked' }}>
          <label for="checkbox_Delete_history_priv">
            <code>
              <dfn title="{{ t('Allows deleting historical rows.') }}">
                DELETE HISTORY
              </dfn>
            </code>
          </label>
        </div>
      {% endif %}
    </div>
    </div>
  </div>

{% else %}

{% set grant_count = 0 %}
<div class="card mb-3">
  <div class="card-header js-submenu-label" data-submenu-label="
    {%- if is_global %}
      {{- t('Global') -}}
    {% elseif is_database %}
      {{- t('Database') -}}
    {% else %}
      {{- t('Table') -}}
    {% endif %}">
    {% if is_global %}
      {{ t('Global privileges') }}
    {% elseif is_database %}
      {{ t('Database-specific privileges') }}
    {% else %}
      {{ t('Table-specific privileges') }}
    {% endif %}
    <input type="checkbox" id="addUsersForm_checkall" class="checkall_box" title="{{ t('Check all') }}">
    <label for="addUsersForm_checkall">{{ t('Check all') }}</label>
  </div>
  <div class="card-body row g-3">
  <p class="col-12">
    <small><em>{{ t('Note: MySQL privilege names are expressed in English.') }}</em></small>
  </p>
    <div class="col">
  <div class="card">
    <div class="card-header">
      <input type="checkbox" class="sub_checkall_box" id="checkall_Data_priv" title="{{ t('Check all') }}">
      <label for="checkall_Data_priv">{{ t('Data') }}</label>
    </div>

    <div class="card-body">
    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Select_priv" id="checkbox_Select_priv" value="Y" title="
        {{- t('Allows reading data.') }}"{{ (row['Select_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Select_priv">
        <code>
          <dfn title="{{ t('Allows reading data.') }}">
            SELECT
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Insert_priv" id="checkbox_Insert_priv" value="Y" title="
        {{- t('Allows inserting and replacing data.') }}"{{ (row['Insert_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Insert_priv">
        <code>
          <dfn title="{{ t('Allows inserting and replacing data.') }}">
            INSERT
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Update_priv" id="checkbox_Update_priv" value="Y" title="
        {{- t('Allows changing data.') }}"{{ (row['Update_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Update_priv">
        <code>
          <dfn title="{{ t('Allows changing data.') }}">
            UPDATE
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Delete_priv" id="checkbox_Delete_priv" value="Y" title="
        {{- t('Allows deleting data.') }}"{{ (row['Delete_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Delete_priv">
        <code>
          <dfn title="{{ t('Allows deleting data.') }}">
            DELETE
          </dfn>
        </code>
      </label>
    </div>

    {% if is_global %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="File_priv" id="checkbox_File_priv" value="Y" title="
          {{- t('Allows importing data from and exporting data into files.') }}"{{ (row['File_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_File_priv">
          <code>
            <dfn title="{{ t('Allows importing data from and exporting data into files.') }}">
              FILE
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}
    </div>
  </div>
    </div>
    <div class="col">
  <div class="card">
    <div class="card-header">
      <input type="checkbox" class="sub_checkall_box" id="checkall_Structure_priv" title="{{ t('Check all') }}">
      <label for="checkall_Structure_priv">{{ t('Structure') }}</label>
    </div>

    <div class="card-body">
    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Create_priv" id="checkbox_Create_priv" value="Y" title="
        {%- if is_database %}
          {{- t('Allows creating new databases and tables.') -}}
        {% else %}
          {{- t('Allows creating new tables.') -}}
        {% endif %}"{{ (row['Create_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Create_priv">
        <code>
          <dfn title="
            {%- if is_database %}
              {{- t('Allows creating new databases and tables.') -}}
            {% else %}
              {{- t('Allows creating new tables.') -}}
            {% endif %}">
            CREATE
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Alter_priv" id="checkbox_Alter_priv" value="Y" title="
        {{- t('Allows altering the structure of existing tables.') }}"{{ (row['Alter_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Alter_priv">
        <code>
          <dfn title="{{ t('Allows altering the structure of existing tables.') }}">
            ALTER
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Index_priv" id="checkbox_Index_priv" value="Y" title="
        {{- t('Allows creating and dropping indexes.') }}"{{ (row['Index_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Index_priv">
        <code>
          <dfn title="{{ t('Allows creating and dropping indexes.') }}">
            INDEX
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Drop_priv" id="checkbox_Drop_priv" value="Y" title="
        {%- if is_database %}
          {{- t('Allows dropping databases and tables.') -}}
        {% else %}
          {{- t('Allows dropping tables.') -}}
        {% endif %}"{{ (row['Drop_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Drop_priv">
        <code>
          <dfn title="
            {%- if is_database %}
              {{- t('Allows dropping databases and tables.') -}}
            {% else %}
              {{- t('Allows dropping tables.') -}}
            {% endif %}">
            DROP
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Create_tmp_table_priv" id="checkbox_Create_tmp_table_priv" value="Y" title="
        {{- t('Allows creating temporary tables.') }}"{{ (row['Create_tmp_table_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Create_tmp_table_priv">
        <code>
          <dfn title="{{ t('Allows creating temporary tables.') }}">
            CREATE TEMPORARY TABLES
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Show_view_priv" id="checkbox_Show_view_priv" value="Y" title="
        {{- t('Allows performing SHOW CREATE VIEW queries.') }}"{{ (row['Show_view_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Show_view_priv">
        <code>
          <dfn title="{{ t('Allows performing SHOW CREATE VIEW queries.') }}">
            SHOW VIEW
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Create_routine_priv" id="checkbox_Create_routine_priv" value="Y" title="
        {{- t('Allows creating stored routines.') }}"{{ (row['Create_routine_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Create_routine_priv">
        <code>
          <dfn title="{{ t('Allows creating stored routines.') }}">
            CREATE ROUTINE
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Alter_routine_priv" id="checkbox_Alter_routine_priv" value="Y" title="
        {{- t('Allows altering and dropping stored routines.') }}"{{ (row['Alter_routine_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Alter_routine_priv">
        <code>
          <dfn title="{{ t('Allows altering and dropping stored routines.') }}">
            ALTER ROUTINE
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Execute_priv" id="checkbox_Execute_priv" value="Y" title="
        {{- t('Allows executing stored routines.') }}"{{ (row['Execute_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Execute_priv">
        <code>
          <dfn title="{{ t('Allows executing stored routines.') }}">
            EXECUTE
          </dfn>
        </code>
      </label>
    </div>

    {% if row['Create_view_priv'] is defined %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Create_view_priv" id="checkbox_Create_view_priv" value="Y" title="
          {{- t('Allows creating new views.') }}"{{ row['Create_view_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Create_view_priv">
          <code>
            <dfn title="{{ t('Allows creating new views.') }}">
              CREATE VIEW
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}

    {% if row['Create View_priv'] is defined %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Create View_priv" id="checkbox_Create View_priv" value="Y" title="
          {{- t('Allows creating new views.') }}"{{ row['Create View_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Create View_priv">
          <code>
            <dfn title="{{ t('Allows creating new views.') }}">
              CREATE VIEW
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}

    {% if row['Event_priv'] is defined %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Event_priv" id="checkbox_Event_priv" value="Y" title="
          {{- t('Allows to set up events for the event scheduler.') }}"{{ row['Event_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Event_priv">
          <code>
            <dfn title="{{ t('Allows to set up events for the event scheduler.') }}">
              EVENT
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Trigger_priv" id="checkbox_Trigger_priv" value="Y" title="
          {{- t('Allows creating and dropping triggers.') }}"{{ row['Trigger_priv'] == 'Y' ? ' checked' }}>
        <label for="checkbox_Trigger_priv">
          <code>
            <dfn title="{{ t('Allows creating and dropping triggers.') }}">
              TRIGGER
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}
    </div>
  </div>
    </div>
    <div class="col">

  <div class="card">
    <div class="card-header">
      <input type="checkbox" class="sub_checkall_box" id="checkall_Administration_priv" title="{{ t('Check all') }}">
      <label for="checkall_Administration_priv">{{ t('Administration') }}</label>
    </div>

    <div class="card-body">

    {% if is_global %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Grant_priv" id="checkbox_Grant_priv" value="Y" title="
          {{- t('Allows adding users and privileges without reloading the privilege tables.') }}"{{ (row['Grant_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Grant_priv">
          <code>
            <dfn title="{{ t('Allows adding users and privileges without reloading the privilege tables.') }}">
              GRANT
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Super_priv" id="checkbox_Super_priv" value="Y" title="
          {{- t('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.') }}"
          {{- (row['Super_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Super_priv">
          <code>
            <dfn title="{{ t('Allows connecting, even if maximum number of connections is reached; required for most administrative operations like setting global variables or killing threads of other users.') }}">
              SUPER
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Process_priv" id="checkbox_Process_priv" value="Y" title="
          {{- t('Allows viewing processes of all users.') }}"{{ (row['Process_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Process_priv">
          <code>
            <dfn title="{{ t('Allows viewing processes of all users.') }}">
              PROCESS
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Reload_priv" id="checkbox_Reload_priv" value="Y" title="
          {{- t("Allows reloading server settings and flushing the server's caches.") }}"{{ (row['Reload_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Reload_priv">
          <code>
            <dfn title="{{ t("Allows reloading server settings and flushing the server's caches.") }}">
              RELOAD
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Shutdown_priv" id="checkbox_Shutdown_priv" value="Y" title="
          {{- t('Allows shutting down the server.') }}"{{ (row['Shutdown_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Shutdown_priv">
          <code>
            <dfn title="{{ t('Allows shutting down the server.') }}">
              SHUTDOWN
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Show_db_priv" id="checkbox_Show_db_priv" value="Y" title="
          {{- t('Gives access to the complete list of databases.') }}"{{ (row['Show_db_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Show_db_priv">
          <code>
            <dfn title="{{ t('Gives access to the complete list of databases.') }}">
              SHOW DATABASES
            </dfn>
          </code>
        </label>
      </div>
    {% else %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Grant_priv" id="checkbox_Grant_priv" value="Y" title="
          {{- t('Allows user to give to other users or remove from other users the privileges that user possess yourself.') }}"
          {{- (row['Grant_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Grant_priv">
          <code>
            <dfn title="{{ t('Allows user to give to other users or remove from other users the privileges that user possess yourself.') }}">
              GRANT
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="Lock_tables_priv" id="checkbox_Lock_tables_priv" value="Y" title="
        {{- t('Allows locking tables for the current thread.') }}"{{ (row['Lock_tables_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_Lock_tables_priv">
        <code>
          <dfn title="{{ t('Allows locking tables for the current thread.') }}">
            LOCK TABLES
          </dfn>
        </code>
      </label>
    </div>

    <div class="item">
      {% set grant_count = grant_count + 1 %}
      <input type="checkbox" class="checkall" name="References_priv" id="checkbox_References_priv" value="Y" title="
        {{- t('Has no effect in this MySQL version.') }}"{{ (row['References_priv'] ?? null) == 'Y' ? ' checked' }}>
      <label for="checkbox_References_priv">
        <code>
          <dfn title="{{ supports_references_privilege ? t('Allows creating foreign key relations.') : (is_mariadb ? t('Not used on MariaDB.') : t('Not used for this MySQL version.')) }}">
            REFERENCES
          </dfn>
        </code>
      </label>
    </div>

    {% if is_global %}
      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Repl_client_priv" id="checkbox_Repl_client_priv" value="Y" title="
          {{- t('Allows the user to ask where the replicas / primaries are.') }}"{{ (row['Repl_client_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Repl_client_priv">
          <code>
            <dfn title="{{ t('Allows the user to ask where the replicas / primaries are.') }}">
              REPLICATION CLIENT
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Repl_slave_priv" id="checkbox_Repl_slave_priv" value="Y" title="
          {{- t('Needed for the replication replicas.') }}"{{ (row['Repl_slave_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Repl_slave_priv">
          <code>
            <dfn title="{{ t('Needed for the replication replicas.') }}">
              REPLICATION SLAVE
            </dfn>
          </code>
        </label>
      </div>

      <div class="item">
        {% set grant_count = grant_count + 1 %}
        <input type="checkbox" class="checkall" name="Create_user_priv" id="checkbox_Create_user_priv" value="Y" title="
          {{- t('Allows creating, dropping and renaming user accounts.') }}"{{ (row['Create_user_priv'] ?? null) == 'Y' ? ' checked' }}>
        <label for="checkbox_Create_user_priv">
          <code>
            <dfn title="{{ t('Allows creating, dropping and renaming user accounts.') }}">
              CREATE USER
            </dfn>
          </code>
        </label>
      </div>
    {% endif %}
    </div>
  </div>
    </div>

  {% if is_global %}
    <div class="col">
    <div class="card">
      <div class="card-header">{{ t('Resource limits') }}</div>
      <div class="card-body">
      <p>
        <small><em>{{ t('Note: Setting these options to 0 (zero) removes the limit.') }}</em></small>
      </p>

      <div class="item">
        <label for="text_max_questions">
          <code>
            <dfn title="{{ t('Limits the number of queries the user may send to the server per hour.') }}">
              MAX QUERIES PER HOUR
            </dfn>
          </code>
        </label>
        <input type="number" name="max_questions" id="text_max_questions" value="
          {{- row.max_questions ?? '0' }}" title="
          {{- t('Limits the number of queries the user may send to the server per hour.') }}">
      </div>

      <div class="item">
        <label for="text_max_updates">
          <code>
            <dfn title="{{ t('Limits the number of commands that change any table or database the user may execute per hour.') }}">
              MAX UPDATES PER HOUR
            </dfn>
          </code>
        </label>
        <input type="number" name="max_updates" id="text_max_updates" value="
          {{- row.max_updates ?? '0' }}" title="
          {{- t('Limits the number of commands that change any table or database the user may execute per hour.') }}">
      </div>

      <div class="item">
        <label for="text_max_connections">
          <code>
            <dfn title="{{ t('Limits the number of new connections the user may open per hour.') }}">
              MAX CONNECTIONS PER HOUR
            </dfn>
          </code>
        </label>
        <input type="number" name="max_connections" id="text_max_connections" value="
          {{- row.max_connections ?? '0' }}" title="
          {{- t('Limits the number of new connections the user may open per hour.') }}">
      </div>

      <div class="item">
        <label for="text_max_user_connections">
          <code>
            <dfn title="{{ t('Limits the number of simultaneous connections the user may have.') }}">
              MAX USER_CONNECTIONS
            </dfn>
          </code>
        </label>
        <input type="number" name="max_user_connections" id="text_max_user_connections" value="
          {{- row.max_user_connections ?? '0' }}" title="
          {{- t('Limits the number of simultaneous connections the user may have.') }}">
      </div>
      </div>
    </div>
    </div>
    <div class="col">

    <div class="card">
      <div class="card-header">SSL</div>
      <div class="card-body">
      <div id="require_ssl_div">
        <div class="item">
          <input type="radio" name="ssl_type" id="ssl_type_NONE" title="
            {{- t('Does not require SSL-encrypted connections.') }}" value="NONE"
            {{- (row.ssl_type ?? null) == 'NONE' or (row.ssl_type ?? null) == '' ? ' checked' }}>
          <label for="ssl_type_NONE">
            <code>REQUIRE NONE</code>
          </label>
        </div>

        <div class="item">
          <input type="radio" name="ssl_type" id="ssl_type_ANY" title="
            {{- t('Requires SSL-encrypted connections.') }}" value="ANY"
            {{- (row.ssl_type ?? null) == 'ANY' ? ' checked' }}>
          <label for="ssl_type_ANY">
            <code>REQUIRE SSL</code>
          </label>
        </div>

        <div class="item">
          <input type="radio" name="ssl_type" id="ssl_type_X509" title="
            {{- t('Requires a valid X509 certificate.') }}" value="X509"
            {{- (row.ssl_type ?? null) == 'X509' ? ' checked' }}>
          <label for="ssl_type_X509">
            <code>REQUIRE X509</code>
          </label>
        </div>

        <div class="item">
          <input type="radio" name="ssl_type" id="ssl_type_SPECIFIED" value="SPECIFIED"
            {{- (row.ssl_type ?? null) == 'SPECIFIED' ? ' checked' }}>
          <label for="ssl_type_SPECIFIED">
            <code>SPECIFIED</code>
          </label>
        </div>

        <div id="specified_div" style="padding-left:20px;">
          <div class="item">
            <label for="text_ssl_cipher">
              <code>REQUIRE CIPHER</code>
            </label>
            <input type="text" name="ssl_cipher" id="text_ssl_cipher" value="{{ row.ssl_cipher ?? null }}" size="80" title="
              {{- t('Requires that a specific cipher method be used for a connection.') }}"
              {{- (row.ssl_type ?? null) != 'SPECIFIED' ? ' disabled' }}>
          </div>

          <div class="item">
            <label for="text_x509_issuer">
              <code>REQUIRE ISSUER</code>
            </label>
            <input type="text" name="x509_issuer" id="text_x509_issuer" value="{{ row.x509_issuer ?? null }}" size="80" title="
              {{- t('Requires that a valid X509 certificate issued by this CA be presented.') }}"
              {{- (row.ssl_type ?? null) != 'SPECIFIED' ? ' disabled' }}>
          </div>

          <div class="item">
            <label for="text_x509_subject">
              <code>REQUIRE SUBJECT</code>
            </label>
            <input type="text" name="x509_subject" id="text_x509_subject" value="{{ row.x509_subject ?? null }}" size="80" title="
              {{- t('Requires that a valid X509 certificate with this subject be presented.') }}"
              {{- (row.ssl_type ?? null) != 'SPECIFIED' ? ' disabled' }}>
          </div>
        </div>
      </div>
      </div>
    </div>
    </div>
  {% endif %}
  </div>
</div>
<input type="hidden" name="grant_count" value="{{ grant_count - (row['Grant_priv'] is defined ? 1 : 0) }}">

{% endif %}

{% if has_submit %}
  <div>
    <input type="hidden" name="update_privs" value="1">
    <input class="btn btn-primary" type="submit" value="{{ t('Update user privileges') }}">
  </div>
{% endif %}
